<?php

namespace App\Models\Shop;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Good extends Model
{
    use SoftDeletes;
    protected $dates = ['deleted_at'];
    protected $guarded = ['file', 'tag_id', 'imgs'];

    //每个商品属于一个品牌
    public function mark()
    {
        return $this->belongsTo('App\Models\Shop\Mark');
    }


    //商品可以属于多个分类
    public function tags()
    {
        return $this->belongsToMany('App\Models\Shop\Tag');
    }

    //一个商品有很多相册图片
    public function good_galleries()
    {
        return $this->hasMany('App\Models\Shop\GoodGallery');
    }

    //一个订单有很多订单商品
    public function order_goods()
    {
        return $this->hasMany('App\Models\Shop\OrderGood');
    }


}
